<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String _id=request.getParameter("_");
  request.setAttribute("now",new Date());
%>

<div class="row">
    <div class="col-lg-12">
        <div class="panel">
            <%--<div class="panel-heading">--%>
                <%--<h3 class="panel-title">发文申请表</h3>--%>
            <%--</div>--%>

            <form id="form_outfile_history" class="panel-body form-horizontal form-padding">

                <div class="form-group">
                    <label class="col-md-2 control-label">发文类别<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-6">
                        <input type="text" id="dictItemH" name="dictItemH" class="form-control" value="${outfile.dictItem.name}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">发文标题<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-6">
                        <input type="text" id="nameH" name="nameH" class="form-control" disabled value="${outfile.name}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">文件编号<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-6">
                        <input type="text" id="fileNoH" name="fileNoH" class="form-control" disabled value="${outfile.fileNo}">
                    </div>
                </div>

                <div class="form-group div-Hidden">
                    <label class="col-md-2 control-label">发文时间<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-6">
                        <div class="input-group date">
                            <input type="text" class="form-control" id="datPulishedH" name="datPulishedH" disabled
                                   value=<fmt:formatDate pattern="yyyy-MM-dd" value="${outfile.datPulished}" /> >
                            <span class="input-group-addon"><i class="ti-calendar"></i></span>
                        </div>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-md-2 control-label">通知对象<i class="fa fa-asterisk txt-color-red"></i>
                        <span id="noticeTypeSpan" style="display: none">${outfile.noticeType}</span>
                    </label>
                    <div class="col-md-6">
                        <input type="text" id="noticeTypeH" name="noticeTypeH" class="form-control" disabled>
                    </div>
                </div>

                <div class="form-group" id="divNoticeDeptsH">
                    <label class="col-md-2 control-label">
                        通知部门
                        <i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-6">
                        <input type="text" id="deptNamesH" name="deptNamesH" class="form-control" disabled
                               value="<c:forEach var="item" items="${outfile.noticeDepartments}" varStatus="status">${item.name}<c:if test="${!status.last}">,</c:if></c:forEach>">
                    </div>
                </div>

                <div class="form-group" id="divNoticeUsersH">
                    <label class="col-md-2 control-label">
                        通知个人
                        <i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-6">
                        <input type="text" id="userNamesH" name="userNamesH" class="form-control" disabled
                               value="<c:forEach var="item" items="${outfile.noticeUsers}" varStatus="status">${item.name}<c:if test="${!status.last}">,</c:if></c:forEach>">
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-md-2 control-label">
                        会签对象
                        <i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-6">
                        <input type="text" id="viewerNamesH" name="viewerNamesH" class="form-control" disabled
                               value="<c:forEach var="item" items="${outfile.viewers}" varStatus="status">${item.name}<c:if test="${!status.last}">,</c:if></c:forEach>">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">相关附件<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-6">
                        <input name="hiddenFilesH" id="hiddenFilesAttachmentH" type="hidden" disabled value="${outfile.fileAttachment}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">提交人</label>
                    <div class="col-md-2">
                        <p class="form-control-static">${outfile.creater.name}</p>
                    </div>
                    <label class="col-md-2 control-label">提交日期</label>
                    <div class="col-md-2">
                        <p class="form-control-static"><fmt:formatDate pattern="yyyy-MM-dd" value="${outfile.dateApply}" /></p>
                    </div>
                </div>
            </form>

        </div>
    </div>
</div>

<script>

    // 附件显示
    readLoad({
        objId:"hiddenFilesAttachmentH",
        entityName:"fileAttachmentH",
        sourceId:"hiddenFilesAttachmentH"
    });

    // 加载完成后执行
    $(function(){
        var parent = $("form#form_outfile_history");
        var type = $("#noticeTypeSpan",parent).text();
        if (type=="1") {
            $("#noticeTypeH",parent).val("部门");
            $("#divNoticeDeptsH",parent).show();
            $("#divNoticeUsersH",parent).hide();
        } else if(type=="2"){
            $("#noticeTypeH",parent).val("个人");
            $("#divNoticeDeptsH",parent).hide();
            $("#divNoticeUsersH",parent).show();
        } else {
            $("#noticeTypeH",parent).val("全体员工");
            $("#divNoticeDeptsH",parent).hide();
            $("#divNoticeUsersH",parent).hide();
        }

    })

</script>
